package com.clusterconfig.client;

public class Templates {

	public static String apacheDescription = 
		"<h2>Apache configuration</h2>" + 
		"<p>There are <b>$NUMBER_APACHE_SERVERS$</b> Apache servers each containing <b>1</b> " + 
		"Apache instance giving a total of <b>$NUMBER_APACHE_SERVERS$</b> Apache " + 
		"instance(s).  Each Apache server has <b>$NUMBER_CPUS_APACHE$</b> cores which means " + 
		" MaxClients = <b>$MAX_CLIENTS$</b> giving a total processing power of all Apache " + 
		"instances combined being <b>$TOTAL_APACHE_THREADS$</b> threads.   The MaxClients is " +
		"optimal at 200 * no cpu cores for the prefork mpm and around 300 * no. Cpu Cores for the worker mpm." + 
		"</p>";
	
	public static String apacheDescriptionWorker =
		"<p>The mpm in use is Worker and the ThreadsPerChild has been best determined to be " + 
		"<b>$THREADS_PER_CHILD_WORKER$</b>. This means that <b>MaxClients ($MAX_CLIENTS$) / " + 
		"ThreadsPerChild ($THREADS_PER_CHILD_WORKER$) = Apache server processes " + 
		"($APACHE_PROCESSES$)</b> To further explain, Apache will utilize " + 
		"<b>$APACHE_PROCESSES$</b> system processes each containing " + 
		"<b>$THREADS_PER_CHILD_WORKER$</b> threads when servicing requests.  " + 
		"JkWatchdogInterval was also added for increased maintenance and health of " + 
		"the mod_jk connections.  JkWatchdogInterval is only viable for threaded mpm modules." + 
		"</p>";
	
	public static String preforkMpmTemplate = 
		"<IfModule prefork.c>\n" +
		"ServerLimit         $MAX_CLIENTS$\n" +
		"StartServers        8\n" +
		"MinSpareServers     5\n" +
		"MaxSpareServers     20\n" +
		"MaxClients          $MAX_CLIENTS$\n" +
		"MaxRequestsPerChild 0\n" +
		"</IfModule>\n";
	
	public static String workerMpmTemplate_mod_jk =
		"JkWatchdogInterval 60\n" +
		"\n" +
		"<IfModule worker.c>\n" +
		"StartServers        8\n" +
		"MinSpareThreads     5\n" +
		"MaxSpareThreads     20\n" +
		"MaxClients          $MAX_CLIENTS$\n" +
		"ThreadLimit         $THREADS_PER_CHILD_WORKER$\n" +
		"ThreadsPerChild     $THREADS_PER_CHILD_WORKER$\n" +
		"MaxRequestsPerChild 0\n" +
		"</IfModule>\n";
	
	public static String workerMpmTemplate_mod_proxy =
		"<IfModule worker.c>\n" +
		"StartServers        8\n" +
		"MinSpareThreads     5\n" +
		"MaxSpareThreads     20\n" +
		"MaxClients          $MAX_CLIENTS$\n" +
		"ThreadLimit         $THREADS_PER_CHILD_WORKER$\n" +
		"ThreadsPerChild     $THREADS_PER_CHILD_WORKER$\n" +
		"MaxRequestsPerChild 0\n" +
		"</IfModule>\n";
	
	public static String winntMpmTemplate =
		"JkWatchdogInterval 60\n" +
		"\n" +
		"<IfModule mpm_winnt.c>\n" +
		"ThreadLimit         $THREADS_PER_CHILD_WORKER$\n" +
		"ThreadsPerChild     $THREADS_PER_CHILD_WORKER$\n" +
		"MaxRequestsPerChild 0\n" +
		"</IfModule>\n";
	
	public static String jbossDescription =
		"<h2>JBoss AJP connector configuration</h2>" + 
		"<p>There are <b>$NUMBER_OF_JBOSS_SERVERS$</b> JBoss servers each containing " + 
		"<b>$NUMBER_OF_JBOSS_INSTANCES_PER_SERVER$</b> JBoss instance(s) giving a total " + 
		"of <b>$TOTAL_JBOSS_INSTANCES$</b> JBoss instances.  Each JBoss server has " + 
		"<b>$NUMBER_CPUS_JBOSS$</b> cores which means " + 
		"<b>maxThreads=\"$JBOSS_MAX_THREADS$\"</b> giving a total processing power of all " + 
		"JBoss instances combined being <b>$TOTAL_JBOSS_THREADS$</b> threads.</p>";
	
	public static String ajpConnector = 
		"<Connector port=\"8009\" address=\"${jboss.bind.address}\" protocol=\"AJP/1.3\"\n" +
		"emptySessionPath=\"true\" enableLookups=\"false\" redirectPort=\"8443\"\n" +
		"maxThreads=\"$JBOSS_MAX_THREADS$\" connectionTimeout=\"600000\" />\n";
	
	public static String modjkDescription = 
		"<h2>Mod_jk workers configuration</h2>" + 
		"" + 
		"<p>There are <b>$NUMBER_OF_JBOSS_SERVERS$</b> JBoss servers each containing " + 
		"<b>$NUMBER_OF_JBOSS_INSTANCES_PER_SERVER$</b> JBoss instance(s) giving a total of " + 
		"<b>$TOTAL_JBOSS_INSTANCES$</b> mod_jk workers</p>";
	
	public static String modjkDescriptionWorkerApacheMore =
		"<p>Given the ThreadsPerChild of <b>$THREADS_PER_CHILD_WORKER$</b>  and the " + 
		"<b>MaxClients ($MAX_CLIENTS$) / ThreadsPerChild ($THREADS_PER_CHILD_WORKER$) = " + 
		"Processes ($APACHE_PROCESSES$)</b> and with $NUMBER_APACHE_SERVERS$ Apache " + 
		"instance(s) then the connection_pool_size has been best determined to be " + 
		"<b>$MODJK_CONNECTION_POOL_SIZE$</b>." + 
		"</p>" + 
		"<p>The total Apache threads <b>$TOTAL_APACHE_THREADS$</b> are <b>>=</b> the total " + 
		"Jboss threads <b>$TOTAL_JBOSS_THREADS$</b>.  The mod_jk connection_pool_size was " + 
		"determined to be <b>$MODJK_CONNECTION_POOL_SIZE$</b> via the math " + 
		"<b>$TOTAL_JBOSS_THREADS$</b> total Jboss threads / <b>$TOTAL_JBOSS_INSTANCES$</b> " + 
		"total Jboss instances <b>$THREADS_PER_JBOSS_INSTANCE$</b> threads per JBoss " + 
		"which equals the maxThreads also.  Take the maxThreads of " + 
		"<b>$JBOSS_MAX_THREADS$</b> / <b>$APACHE_PROCESSES$</b> Apache server processes " + 
		"to get the initial connection_pool_size of <b>$INITIAL_CONNECTION_POOL_SIZE$</b>" + 
		" then / this number by the number of Apache instances " + 
		" <b>$NUMBER_APACHE_SERVERS$</b> to arrive at the correct connection_pool_size of" + 
		" <b>$CALCULATED_CONNECTION_POOL_SIZE$</b>." + 
		" </p>";
	
	public static String modjkDescriptionWorkerJBossMore =
		"<p>" + 
		"Given the ThreadsPerChild of <b>$THREADS_PER_CHILD_WORKER$</b>  and the " + 
		"<b>MaxClients ($MAX_CLIENTS$) / ThreadsPerChild ($THREADS_PER_CHILD_WORKER$) = " + 
		"Processes ($APACHE_PROCESSES$)</b> and with $NUMBER_APACHE_SERVERS$ Apache " + 
		"instance(s) then the connection_pool_size has been best determined to be " + 
		"<b>$MODJK_CONNECTION_POOL_SIZE$</b></p>" + 
		"					" + 
		"<p>" + 
		"The total Jboss threads <b>$TOTAL_JBOSS_THREADS$</b> are <b>></b> the total Apache " + 
		"threads <b>$TOTAL_APACHE_THREADS$</b>.  The mod_jk connection_pool_size was " + 
		"determined to be <b>$MODJK_CONNECTION_POOL_SIZE$</b> via the math " + 
		"<b>$MAX_CLIENTS$</b> Apache MaxClients / <b>$TOTAL_JBOSS_INSTANCES$</b> total " + 
		"Jboss instances <b>$MAX_CLIENTS_DIV_TOTAL_JBOSS_INSTANCES$</b> threads per JBoss " + 
		"which will be equal to or less than the maxThreads <b>$JBOSS_MAX_THREADS$</b> in Jboss.   " + 
		"Take this number <b>$MAX_CLIENTS_DIV_TOTAL_JBOSS_INSTANCES$</b> / " + 
		"<b>$APACHE_PROCESSES$</b> Apache server processes to get the " + 
		"connection_pool_size of <b>$CALCULATED_CONNECTION_POOL_SIZE$</b>." + 
		"</p>";
	
	public static String modjkDescriptionWinntJBossMore =
		"<p>" + 
		"Given the ThreadsPerChild of <b>$THREADS_PER_CHILD_WORKER$</b>  and the " + 
		"<b>MaxClients ($MAX_CLIENTS$) / ThreadsPerChild ($THREADS_PER_CHILD_WORKER$) = " + 
		"Processes ($APACHE_PROCESSES$)</b> and with $NUMBER_APACHE_SERVERS$ Apache " + 
		"instance(s) then the connection_pool_size has been best determined to be " + 
		"<b>$MODJK_CONNECTION_POOL_SIZE$</b></p>" + 
		"					" + 
		"<p>" + 
		"The total Jboss threads <b>$TOTAL_JBOSS_THREADS$</b> are <b>></b> the total Apache " + 
		"threads <b>$TOTAL_APACHE_THREADS$</b>.  The mod_jk connection_pool_size was " + 
		"determined to be <b>$MODJK_CONNECTION_POOL_SIZE$</b> via the math " + 
		"<b>$MAX_CLIENTS$</b> Apache MaxClients / <b>$TOTAL_JBOSS_INSTANCES$</b> total " + 
		"Jboss instances <b>$MAX_CLIENTS_DIV_TOTAL_JBOSS_INSTANCES$</b> threads per JBoss " + 
		"which will be equal to or less than the maxThreads <b>$JBOSS_MAX_THREADS$</b> in Jboss.   " + 
		"Take this number <b>$MAX_CLIENTS_DIV_TOTAL_JBOSS_INSTANCES$</b> / " + 
		"<b>$APACHE_PROCESSES$</b> Apache server processes to get the " + 
		"connection_pool_size of <b>$CALCULATED_CONNECTION_POOL_SIZE$</b>." + 
		"</p>";
}
